﻿namespace HySoft.Cash.Business
{
    using Huayou.Common.Database;
    using Huayou.Utils;
    using HySoft.Cash.BaseClass;
    using HySoft.Cash.DB;
    using HySoft.Cash.Structure;
    using System;
    using System.Data;
    using System.Web.UI;

    public class TsysoptionBN : BaseBusiness
    {
        private TsysoptionDB db;

        public TsysoptionBN(Page page) : base(page)
        {
            this.db = null;
            this.db = new TsysoptionDB(base.curDBOperater);
        }

        public TsysoptionBN(Page page, DBOperate oper) : base(page, oper)
        {
            this.db = null;
            this.db = new TsysoptionDB(base.curDBOperater);
        }

        public bool Add(TsysoptionDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Add(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public bool Delete(int Sid)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Delete(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public void Dispose()
        {
            base.Dispose();
            if (this.db != null)
            {
                this.db = null;
            }
        }

        public bool Edit(TsysoptionDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Edit(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public TsysoptionDT Get(int Sid)
        {
            TsysoptionDT ndt = null;
            try
            {
                try
                {
                    ndt = this.db.Get(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return ndt;
        }

        public DataTable GetList()
        {
            base.DBFieldList = "Sid,OptionCode,OptionName,OptionValue,Remark";
            base.DBTable = "tSysOption";
            return base.CommonGetList();
        }

        public void QueryOptionCode(string OptionCode)
        {
            if ((OptionCode != null) && (OptionCode.Trim() != ""))
            {
                base.Filter = "OptionCode like '%" + StringUtils.ToSQL(OptionCode) + "%'";
            }
        }

        public void QueryOptionName(string OptionName)
        {
            if ((OptionName != null) && (OptionName.Trim() != ""))
            {
                base.Filter = "OptionName like '%" + StringUtils.ToSQL(OptionName) + "%'";
            }
        }

        public void QueryOptionValue(string OptionValue)
        {
            if ((OptionValue != null) && (OptionValue.Trim() != ""))
            {
                base.Filter = "OptionValue like '%" + StringUtils.ToSQL(OptionValue) + "%'";
            }
        }

        public void QueryRemark(string Remark)
        {
            if ((Remark != null) && (Remark.Trim() != ""))
            {
                base.Filter = "Remark like '%" + StringUtils.ToSQL(Remark) + "%'";
            }
        }

        public void QuerySid(int Sid)
        {
            base.Filter = "Sid= " + Sid;
        }
    }
}

